from dao.base_dao import BaseDao
from orm_domain.project import Project
from orm_domain.project_testcase_rel import project_testcase_rel

from orm_domain.testcase import Testcase
from server import db_session

class TestcaseDao(BaseDao):
    def save(self, tc:Testcase):
        return self.add(tc)

    def list(self):
        return self.query(Testcase).order_by(Testcase.update_time.desc()).all()



    def get_list(self,**filter_by):
        return self.query(Testcase).filter_by(**filter_by).order_by(Testcase.update_time.desc()).all()

    def get_by_id(self,id) -> Testcase:
        return self.query(Testcase).filter_by(id = id).first()
